package com.householditemtwo.index.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.householditemtwo.common.entity.Carousel;
import com.householditemtwo.common.entity.Compary;
import com.householditemtwo.common.entity.News;
import com.householditemtwo.common.entity.Product;
import com.householditemtwo.common.entity.Producttype;
import com.householditemtwo.common.utils.BaseServlet;
import com.householditemtwo.index.dao.IndexDao;
import com.householditemtwo.index.dao.LyDao;

/**
 * 页面Servlet
 */
@WebServlet("/LyServlet")
public class LyServlet extends BaseServlet {
	private static final long serialVersionUID = 1L;

	// 创建DAo
	LyDao dao = new LyDao();
		/**
		 * 添加留言
		 * @param request
		 * @param response
		 * @throws ServletException
		 * @throws IOException
		 */
	public void addLy(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
			//接受页面传的数据
		String name=request.getParameter("i1");
		String phone=request.getParameter("i2");
		String email=request.getParameter("i3");
		String content=request.getParameter("i4");
		
		//调用Dao处理数据(insert语句)
		int num=dao.addLy(name, phone, email, content);
		request.setAttribute("num",num);
		//转发到页面
        request.getRequestDispatcher("message.jsp").forward(request, response);
	}

}
